<?php
namespace Main\Controller;
use Think\Controller;
class PositionController extends AppController {

    function __construct()
    {
        parent::__construct();
        $this->M_pos = M('Position');//职位表
        $this->M_chmod = M('Chmod');//权限表
        $this->M_chomd_pos = M('Chmod_position');//职位、权限关联表
    }

    public function index(){
        $this->assign('title','职位列表');
        $pos_list = $this->M_pos->select();
        $this->assign('list',$pos_list);
        $this->display();
    }


    public function edit(){
        $pro = array(
            array(
                'name'=>'商城',
                'key'=>'shop',
                'list'=> array(
                    array(
                        'name'=>'商品',
                        'key'=>'goods',
                        'list'=>array(
                            array(
                                'name'=>'商品列表',
                                'key'=>'goods_list',
                            ),
                            array(
                                'name'=>'商品编辑',
                                'key'=>'goods_edit',
                            )
                        )
                    ),
                    array(
                        'name'=>'订单',
                        'key'=>'orders',
                        'list'=>array(
                            array(
                                'name'=>'订单列表',
                                'key'=>'goods_list',
                            ),
                            array(
                                'name'=>'订单编辑',
                                'key'=>'goods_edit',
                            )
                        )
                    ),
                )
            ),
            array(
                'name'=>'视频',
                'key'=>'curr',
                'list'=> array(
                    array(
                        'name'=>'分类',
                        'key'=>'cate',
                        'list'=>array(
                            array(
                                'name'=>'分类列表',
                                'key'=>'cate_list',
                            ),
                            array(
                                'name'=>'分类编辑',
                                'key'=>'cate_edit',
                            )
                        )
                    ),
                    array(
                        'name'=>'视频',
                        'key'=>'curr',
                        'list'=>array(
                            array(
                                'name'=>'视频列表',
                                'key'=>'curr_list',
                            ),
                            array(
                                'name'=>'视频编辑',
                                'key'=>'curr_edit',
                            )
                        )
                    ),
                )
            )
        );
        dump($pro);die;
        $this->assign('pos',$pro);
        $id = I('get.id',0,'intval');
        if($id){
            $list = $this->M_chomd_pos->where('chomod_id = '.$id)->select();
            $this->assign('list',$list);
        }
        $chmod_list = $this->M_chmod->select();
        $this->assign('chmod',$chmod_list);
        $this->display();
    }


}